import Vue from 'vue'
import VueI18n from 'vue-i18n'
import enUS from './en.js'
import zhCN from './zh-CN.js'
import jpn from './jpn.js'

Vue.use(VueI18n)

//  设置语言
let lang = uni.getStorageSync('_lang').data
if(!lang || lang === 'System'){
	const res = uni.getSystemInfoSync()
	lang = res.language
	uni.setStorageSync('_lang', 'System')
}

const i18n = new VueI18n({
	locale: lang,
	fallbackLocale: 'en',
	silentFallbackWarn: true,
	messages: {
		'en': enUS,
		'zh-CN': zhCN,
		'jpn': jpn
	}
})
export default i18n
